#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QButtonGroup *group1=new  QButtonGroup(this);
     QButtonGroup *group2=new  QButtonGroup(this);
      QButtonGroup *group3=new  QButtonGroup(this);

      group1->addButton(ui->radioButton);
      group1->addButton(ui->radioButton_2);
      group1->addButton(ui->radioButton_3);

        group2->addButton(ui->radioButton_4);
          group2->addButton(ui->radioButton_5);
            group2->addButton(ui->radioButton_6);

              group3->addButton(ui->radioButton_7);
                group3->addButton(ui->radioButton_8);}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    //汉堡
    if(ui->radioButton->isChecked())
    qDebug()<<"汉堡："<<ui->radioButton->text()<<" ";
    else  if(ui->radioButton_2->isChecked())
        qDebug()<<"汉堡："<<ui->radioButton_2->text()<<" ";
    else
        qDebug()<<"汉堡："<<ui->radioButton_3->text()<<" ";
    //小食

    if(ui->radioButton_4->isChecked())
    qDebug()<<"小食："<<ui->radioButton_4->text()<<" ";
    else  if(ui->radioButton_5->isChecked())
        qDebug()<<"小食："<<ui->radioButton_5->text()<<" ";
    else
        qDebug()<<"小食："<<ui->radioButton_6->text()<<" ";
    //饮料
    if(ui->radioButton_7->isChecked())
    qDebug()<<"饮料："<<ui->radioButton_7->text()<<" ";
    else
        qDebug()<<"饮料："<<ui->radioButton_8->text()<<" ";
}
